#include "../../client/rpc_client.hpp"

void callback(Json::Value res)
{
    ELOG("result:%d",res.asInt());
}
int main()
{
    BRpc::Client::RpcClient client(true,"127.0.0.1",9090);
    //同步调用测试
    Json::Value params,result;
    params["num1"]=11;
    params["num2"]=22;
    bool ret=client.call("Add",params,result);
    if(ret!=false)
    {
        std::cout<<result.asInt()<<std::endl;
    }
    //异步调用测试
    params["num1"]=100;
    params["num2"]=1000;
    BRpc::Client::RpcCaller::JsonAsyncResponse res_future;
    ret=client.call("Add",params,res_future);
    if(ret!=false)
    {
        ELOG("result:%d",res_future.get().asInt());
    }
    //回调调用测试
    params["num1"]=109;
    params["num2"]=1000;
    ret=client.call("Add",params,callback);
    sleep(5);
    return 0;
}